/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ill_be_bach.model;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Abhi
 */
public enum Tempo {
    Grave(40),
    Largo(45),
    Larghetto(50),
    Lento (55),
    Adagio(60),
    Adagietto(65),
    Andante(70),
    Andantino(80),
    Moderato(95),
    Allegreto(110),
    Allegro(120),
    Vivace(145),
    Presto(180),
    Prestissimo(220);

    private static final Map<Integer,Tempo> lookup
          = new HashMap<Integer,Tempo>();
     static {
          for(Tempo t : EnumSet.allOf(Tempo.class))
               lookup.put(t.getBeatsPerMinute(), t);
     }

    private int beatsPerMinute ;

    private Tempo(int beatsPerMinute) {
        this.beatsPerMinute = beatsPerMinute;
    }

    public int getBeatsPerMinute() {
        return beatsPerMinute ;
    }

    public static Tempo get(int beatsPerMinute) {
        return lookup.get(beatsPerMinute);
    }
}
